from scipy.integrate import quad

def func(x):
    return x ** 2

if __name__ == '__main__':
    solution = quad(func, 0, 1)
    # 返回结果保存两部分：积分值和误差
    print(solution)
    print(solution[0])

    # x2 = lambda x: x ** 2
    # print(quad(x2, 0, 4))
    #
    # f = lambda x, a: a * x
    # y, err = quad(f, 0, 1, args=(1,))
    # print(y)
    # print(err)
